package com.han.spring.core.aop.proxy.dy;

import com.han.spring.core.aop.proxy.st.Math1;
import com.han.spring.core.aop.proxy.st.MathImpl;

/**
* @author hanpeng
* @version 创建时间：2020年7月8日 下午9:38:08
* @ClassName 类名称
* @Description 类描述
*/
public class DynamicProxyTest {
	public static void main(String[] args) {
		//这就叫层层包  mathImpl传一个就行 其它的
		MathImpl mathImpl = new MathImpl();
		MathHandler1 mathHandler1 = new MathHandler1(mathImpl);
		
		Math1 dynamicProxy = (Math1)ProxyUtil.getDynamicProxy(mathImpl, mathHandler1);
		MathHandler2 mathHandler2 = new MathHandler2(dynamicProxy);
		
		Math1 dynamicProxy2 = (Math1)ProxyUtil.getDynamicProxy(mathImpl, mathHandler2);
		int add = dynamicProxy2.add(1, 2);
		System.out.println(add);
		
		
		
	}
}
